package wanxiang

import (
	"gitee.com/gam6it/SecToolkit/utils/http2"
)

/**
主机发现功能
*/

type DiscoveredHost struct {
	Id                string   `json:"id"`
	MacAddr           string   `json:"macAddr"`
	IpAddr            string   `json:"ipAddr"`
	DeviceType        string   `json:"deviceType"`
	OsFamily          string   `json:"osFamily"`
	AgentId           string   `json:"agentId"`
	DiscoveryIp       string   `json:"discoveryIp"`
	AgentStatus       int      `json:"agentStatus"`
	ScanMethods       []string `json:"scanMethods"`
	FirstDiscoverTime int64    `json:"firstDiscoverTime"`
	LastDiscoverTime  int64    `json:"lastDiscoverTime"`
	OsType            int      `json:"osType"`
}

func (c *Client) GetDiscoveredHosts() (*[]DiscoveredHost, error) {
	api := "/external/api/discoveredhost/list"
	type resp struct {
		Total int64            `json:"total"`
		Rows  []DiscoveredHost `json:"rows"`
	}
	var result resp
	err := c.Request(http2.MethodGet, api, &result, nil)
	return &result.Rows, err
}
